﻿@page
@using Volo.Abp.Account.Web.Settings
@model Volo.Abp.Account.Web.Pages.Account.LoginModel
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage
@inject Volo.Abp.Settings.ISettingProvider SettingProvider
<div class="text-center">
    <h1 class="h4 text-gray-900 mb-4">@L["Login"]</h1>
</div>
@if (Model.EnableLocalLogin)
{
    <form method="post" class="user">
        <input asp-for="ReturnUrl" />
        <input asp-for="ReturnUrlHash" />
        <div class="form-group">
            <input asp-for="LoginInput.UserNameOrEmailAddress" class="form-control form-control-user" id="exampleInputEmail" placeholder="Enter Account...">
            <span asp-validation-for="LoginInput.UserNameOrEmailAddress" class="text-danger"></span>
        </div>
        <div class="form-group">
            <input type="password" asp-for="LoginInput.Password" class="form-control form-control-user" id="exampleInputPassword" placeholder="Password">
            <span asp-validation-for="LoginInput.Password" class="text-danger"></span>
        </div>
        <div class="form-group">
            <div class="custom-control custom-checkbox small">
                <input asp-for="LoginInput.RememberMe" type="checkbox" class="custom-control-input" id="customCheck">
                <label asp-for="LoginInput.RememberMe" class="custom-control-label" for="customCheck">@L[@Html.DisplayNameFor(m => m.LoginInput.RememberMe)]</label>
            </div>
        </div>
        <div class="form-group">
            <abp-button type="submit" class="btn btn-primary btn-user btn-block" button-type="Primary" name="Action" value="Login">@L["Login"]</abp-button>
        </div>
    </form>
}

@if (Model.VisibleExternalProviders.Any())
{
    <hr>
    <div class="col-md-6">
        <h4>@L["UseAnotherServiceToLogIn"]</h4>
        <form asp-page="./Login" asp-page-handler="ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" asp-route-returnUrlHash="@Model.ReturnUrlHash" method="post">
            <input asp-for="ReturnUrl" />
            <input asp-for="ReturnUrlHash" />
            @foreach (var provider in Model.VisibleExternalProviders)
            {
                <button type="submit" class="btn btn-primary" name="provider" value="@provider.AuthenticationScheme" title="@L[" GivenTenantIsNotAvailable", provider.DisplayName]">@provider.DisplayName</button>
            }
        </form>
    </div>
}

@if (!Model.EnableLocalLogin && !Model.VisibleExternalProviders.Any())
{
    <div class="alert alert-warning">
        <strong>@L["InvalidLoginRequest"]</strong>
        @L["ThereAreNoLoginSchemesConfiguredForThisClient"]
    </div>
}
